package com.example.piece.ui.demo

import android.os.Bundle
import android.util.Log
import android.view.View
import androidx.databinding.ViewDataBinding
import com.therouter.router.Route
import com.example.base.broadcast.Event
import com.example.base.networktools.IPTools
import com.example.piece.R
import com.example.piece.constant.RoutePath
import com.example.piece.databinding.TestActivityTcpClientactivityBinding
import com.example.piece.ui.activity.Layer3Activity

/**
 * TCP测试  客户端
 */
@Route(path = RoutePath.TESTActivity.TCP_CLIENT_TEST_ACTIVITY)
class TCPClientTestActivity :  Layer3Activity<TestActivityTcpClientactivityBinding, ViewDataBinding>() {

    override val isTransparentStatusBar: Boolean = false

    override val isDarkMode: Boolean = false
    override val centerLayoutRes: Int
        get() = R.layout.test_activity_tcp_clientactivity
    override val title: String
        get() = "TCP测试客户端"
    override val leftIcon1Res: Int
        get() = R.drawable.ic_back

    override fun isRegisterEventBus()=true
    override fun onClickLeftIcon1(view: View) {
        super.onClickLeftIcon1(view)
        onBackPressed()
    }
    override fun initData(savedInstanceState: Bundle?) {
        super.initData(savedInstanceState)

        Thread {
            val localHostAddress = IPTools.getLocalIPv4Address()
            Log.e("TAG", "onClickLeftIcon1: " + localHostAddress)

            mCenterViewBinding?.addressNmae = localHostAddress.hostAddress
        }.start()

    }

    override fun onEventBusCome(event: Event<Any>?) {
        super.receiveEvent(event)
    }



}